<template>
  <div class="app-container">
    <div class="upload-box">
        <div class="upload-item">
          <file-upload :isShowTip="false">
            <div class="up-tips">
              <img class="up-icon" src="@/assets/images/material/up2.png" alt="">
              <div class="title">点击上传</div>
              <div class="tips">请选择表格文件</div>
            </div>
          </file-upload>
        </div>
        <div class="upload-item">
          <image-upload :isShowTip="false" @input="uploadImg">
            <div class="up-tips">
              <img class="up-icon" src="@/assets/images/material/up2.png" alt="">
              <div class="title">点击上传</div>
              <div class="tips">支持ipg、png、webp格式</div>
            </div>
          </image-upload>
        </div>
        <div class="upload-item">
          <image-upload :isShowTip="false">
            <div class="up-tips">
              <img class="up-icon" src="@/assets/images/material/up3.png" alt="">
              <div class="title">点击上传</div>
              <div class="tips">支持mp4、avi、mov、flv格式</div>
            </div>
          </image-upload>
        </div>
      </div>

      <!-- <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="正在上传" name="loding"></el-tab-pane>
        <el-tab-pane label="上传完成" name="sunccess"></el-tab-pane>
      </el-tabs> -->
      <el-table v-loading="loading" :data="engineList">
        <el-table-column label="序号" align="center" prop="id" />
        <el-table-column label="文件名" align="center" prop="collectType" />
        <el-table-column label="大小" align="center" prop="workOpen" />
        <el-table-column label="状态" align="center" prop="collectPlatform" />
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
          <template slot-scope="scope">
            <el-button size="mini" type="text" @click="handleUpdate(scope.row)"
              v-hasPermi="['system:engine:edit']">重新上传</el-button>
            <el-button size="mini" type="text" @click="handleDelete(scope.row)"
              v-hasPermi="['system:engine:remove']">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <!--     
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    /> -->
  </div>
</template>

<script>
import { listConfig, getConfig, delConfig, addConfig, updateConfig, refreshCache } from "@/api/system/config";
import { getMaterialStatistics } from "@/api/material/material";
import BarChart from "../../dashboard/BarChart.vue";
import LineChart from "../../dashboard/LineChart.vue"
import PieChart from "../../dashboard/PieChart.vue"
export default {
  name: "Config",
  dicts: ['sys_yes_no'],
  components: { BarChart, LineChart, PieChart },
  data() {
    return {
      loading: true,
      title: "素材录入",
      open: false,
      chartData: {},
      pieChart: {},
      engineList: [],
      activeName: 'loding',
      totalCount: null,//数据总量
      sourceList: [],//数据来源
    };
  },
  created() {
    this.getMaterialStatistics();
  },
  methods: {
    /** 查询参数列表 */
    getMaterialStatistics() {
      this.loading = true;
      getMaterialStatistics().then(response => {
        console.log(response)
        // 数据总量
        this.totalCount = response.data.totalCount
        // 模态分布
        const typeCount = response.data.typeCount
        const actualData = [
          {
            value: typeCount.image,
            name: '图片'
          },
          {
            value: typeCount.text,
            name: '文本'
          },
          {
            value: typeCount.video,
            name: '视频'
          }
        ]
        this.pieChart = {
          expectedData: ['图片', '文本', '视频'],
          actualData
        }
        // 数据来源
        this.sourceList = response.data.totalGroups
      });
    },
    cancel() { },
    submitForm() { },
    upFodder() {
      this.open = true
    },
    handleClick(e) {
      console.log(e)
    },
    // 上传图片
    uploadImg(list){
      console.log(list)
    }
  }
};
</script>
<style lang="scss" scoped>
.app-container {
  padding: 0;
}

.header {
  position: relative;

  .header-tit {
    width: 100%;
  }

  .header-btn {
    position: absolute;
    top: 20px;
    left: 50px;
    right: 50px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}

.center-con {
  display: flex;
  justify-content: space-between;
  margin: -65px 20px 0;

  .data-source {
    width: 504px;

    .left-title {
      margin-top: 20px;
      margin-bottom: 10px;
    }

    .source-list {
      height: 228px;
      background-image: url("../../../assets/images/material/source_bg.png");
      background-size: cover;
      color: #fff;
      overflow: hidden;

      .source-item {
        float: left;
        width: 97px;
        height: 38px;
        line-height: 38px;
        background-image: url("../../../assets/images/material/item_bg.png");
        background-size: cover;
        color: #00FCFF;
        margin-left: 23px;
        margin-top: 15px;
        text-align: center;
        white-space: nowrap;
        /* 不换行 */
        overflow: hidden;
        /* 隐藏超出的内容 */
        text-overflow: ellipsis;
        /* 添加省略号 */
        padding: 0 8px;
      }
    }
  }

  .data-gross {
    flex: 1;
    background-image: url("../../../assets/images/material/gross_bg.png");
    background-size: 100%;
    background-repeat: no-repeat;
    background-position: center;
    text-align: center;

    .map-num {
      font-size: 24px;
      color: #fff;
      text-align: center;
      margin-top: 50px;
      font-family: 'PangMenZhengDao-3';

      .num {
        width: 200px;
        text-align: center;
        display: inline-block;
        color: rgba(0, 252, 255, 1);
        border: 1px dashed rgba(34, 177, 240, 0.45);
        background: rgba(14, 181, 255, 0.1);
        padding: 5px 10px;
        margin-left: 10px;
      }
    }

    .map {
      width: 70%;
      margin-top: 40px;
    }
  }

  .right-mode {
    width: 504px;

    .data-bg-ring {
      background-image: url("../../../assets/images/material/ring_bg.png");
      background-size: 100%;
      background-repeat: no-repeat;
    }

    .data-bg-column {
      background-image: url("../../../assets/images/material/column_bg.png");
      background-size: 100%;
      background-repeat: no-repeat;
    }

    .right-title {
      margin-top: 20px;
      margin-bottom: 10px;
    }
  }
}

img {
  width: 100%;
}

.upload-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;

  .upload-item {
    width: 286px;
    height: 210px;
    border: 1px dashed #D4DEEA;
    text-align: center;

    .up-tips {
      display: flex;
      flex-flow: column;
      align-items: center;
      margin-top: 30px;

      .up-icon {
        width: 80px;
        height: 80px;
        margin-bottom: 10px;
      }

      .title {
        font-size: 16px;
        color: #000;
        height: 30px;
        line-height: 30px;
      }

      .tips {
        font-size: 14px;
        color: #676767;
        height: 30px;
        line-height: 30px;
      }
    }
  }
}

::v-deep {
  .el-upload--picture-card {
    background: none;
    border: none;
    width: 286px;
    height: 210px;
  }
}
</style>
